package com.nancal.activiti.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ModelImageMapper {

    //查询图片
    @Select("SELECT SVG FROM ACT_MODEL_SVG WHERE MODEL_ID_=#{modelId}")
    String findSvgByModelId(String modelId);

    @Insert("insert into ACT_MODEL_SVG(MODEL_ID_,SVG) values(#{modelId},#{svg})")
    void addSvgAndModelId(@Param("modelId") String modelId, @Param("svg") String svg);


    @Update("update ACT_MODEL_SVG set SVG=#{svg_xmls} where MODEL_ID_=#{modelId}")
    void addSvgBytesAndModelId(@Param("modelId") String modelId, @Param("svg_xmls") byte[] svg_xmls);


    //根据模型id修改模型图片
    @Update("update ACT_MODEL_SVG set SVG=#{svg_xmls} where MODEL_ID_=#{modelId}")
    void updateSvgBytesByModelId(String modelId, byte[] svg_xmls);

    @Insert("insert ACT_MODEL_SVG(MODEL_ID_,TABLE_FORM) values(#{modelId},#{fileName})")
    void addFileByModelId(String fileName, String modelId);

    @Select("SELECT TABLE_FORM FROM ACT_MODEL_SVG WHERE MODEL_ID_=#{modelId}")
    String findFileBymodelId(String modelId);
}
